package com.lx.book.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.lx.book.entity.Student;
import com.lx.book.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService{

    @Autowired
    StudentMapper studentMapper;

    @Override
    public List<Student> getPage(Student student) {
        QueryWrapper queryWrapper=new QueryWrapper();
        if(student.getStudentname()!=null && student.getStudentname()!=""){
            queryWrapper.like("studentname",student.getStudentname());
        }
        return studentMapper.selectList(queryWrapper);
    }

    @Override
    public boolean add(Student student) {
        return studentMapper.add(student);
    }
}
